package com.situ.controller;

import com.situ.domain.entity.TBanner;
import com.situ.service.BannerService;
import com.situ.utils.Result;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/banner")
@RequiredArgsConstructor
@Tag(name = "轮播图接口")
public class BannerController {


    private final BannerService bannerService;

    @GetMapping("/getBannerList")
    @Cacheable(value = "index:banner", key = "'getBannerList'")
    @Operation(summary = "查询轮播图列表")
    public Result getBannerList() {
        List<TBanner> list = bannerService.list();
        return Result.success(200,"查询成功",list);
    }
}
